home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / dev / misc / LEDA_gene.lha / LEDA-3.1c-generic / incl / LEDA / impl / iloc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-05  |  3.4 KB  |  96 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  3.1c
  4. +
  5. +
  6. +  iloc.h
  7. +
  8. +
  9. +  Copyright (c) 1994  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. /*              iloc.h          RD, 18.12.89 */
  16.  
  17. #ifndef ILOC_H
  18. #define ILOC_H
  19.  
  20. #include "iint.h"
  21.  
  22. #define LOGRADIX LOGPLACE
  23.  
  24. #ifndef USE_64_BIT_INTEGERS
  25.     typedef     UNSIGNED32     DOUBLEPLACE;
  26.     typedef     SIGNED32     SDOUBLEPLACE;
  27. #define RADIX 0x10000
  28. #define HALFRADIX 0x8000
  29. #define RADIXMINUSONE 0xffff
  30. #else
  31.     typedef     UNSIGNED64     DOUBLEPLACE;
  32.     typedef     SIGNED64     SDOUBLEPLACE;
  33. #define RADIX 0x100000000
  34. #define HALFRADIX 0x80000000
  35. #define RADIXMINUSONE 0xffffffff
  36. #endif
  37.  
  38. #define INITLENGTH 4
  39.  
  40. EXTERN_FUNCTION(PLACE PLACEadd, (PLACE a, PLACE b, PLACE carry, PLACE *sum));
  41.     /* *sum=a+b+carry, return Uebertrag */
  42. EXTERN_FUNCTION(PLACE PLACEsub, (PLACE a, PLACE b, PLACE carry, PLACE *diff));
  43.     /* *diff=a-b-carry, return Uebertrag */
  44. EXTERN_FUNCTION(PLACE PLACEmuladd,(PLACE a,PLACE b,PLACE carry,PLACE *paccu));
  45.     /* *paccu=*paccu+a*b+carry, return Uebertrag */
  46. EXTERN_FUNCTION(PLACE PLACEmul,(PLACE a,PLACE b,PLACE carry,PLACE *paccu));
  47.     /* *paccu=a*b+carry, return Uebertrag */
  48. EXTERN_FUNCTION(PLACE PLACEmulsub,(PLACE a,PLACE b,PLACE carry,PLACE *paccu));
  49.     /* *paccu=*paccu-a*b-carry, return Uebertrag */
  50. EXTERN_FUNCTION(PLACE PLACEdiv, (PLACE h, PLACE l, PLACE n, PLACE *q));
  51.     /* h*RADIX+l / n ergibt Quotient *q, return Rest */
  52.  
  53. EXTERN_FUNCTION(void cvecsubto, (PLACE *a, PLACE *b, int count));
  54.         /* a[]-=b[count]; */
  55. EXTERN_FUNCTION(int cvadd, (PLACE *sum, PLACE *a, PLACE *b, 
  56.                 int counta, int countb));
  57.     /* sum[]=a[counta]+b[countb]; return sum->length */
  58. EXTERN_FUNCTION(int cvsub, (PLACE *diff, PLACE *a, PLACE *b, 
  59.                 int counta, int countb));
  60.     /* diff[]=a[counta]-b[countb]; return diff->length */
  61.  
  62. EXTERN_FUNCTION(PLACE vecaddto, (PLACE *a, PLACE *b, int count));
  63.     /* a[count]+=b[count]; return carry; */
  64. EXTERN_FUNCTION(PLACE vecsubto, (PLACE *a, PLACE *b, int count));
  65.         /* a[count]-=b[count]; return carry; 0 oder 1 */
  66. EXTERN_FUNCTION(BOOLEAN veceq, (PLACE *a, PLACE *b, int count));
  67.         /* return a[count]==b[count]; */
  68. EXTERN_FUNCTION(BOOLEAN vecgt, (PLACE *a, PLACE *b, int count));
  69.         /* return a[count]>b[count] lexikographisch */
  70. EXTERN_FUNCTION(PLACE vecdiv, (PLACE *q, PLACE *a, PLACE d, int count));
  71.         /* q[count]=a[count]/d; return a[count]%d; */
  72. EXTERN_FUNCTION(PLACE vecmul, (PLACE *product, PLACE *a, PLACE m, int count));
  73.         /* product[count]=m*a[count]; return carry; */
  74. EXTERN_FUNCTION(PLACE vecmuladd, (PLACE *paccu, PLACE *a, PLACE m, int count));
  75.         /* paccu[count] += m*a[count]; return carry; */
  76. EXTERN_FUNCTION(PLACE vecmulsub, (PLACE *paccu, PLACE *a, PLACE m, int count));
  77.         /* paccu[count+1] -= m*a[count]; return carry; 
  78.         carry ist 0 oder 1 */
  79.  
  80. EXTERN_FUNCTION(BOOLEAN vecsr1, (PLACE *u, int l));
  81.     /* b=u[l]%2; u[l]/=2; return b; */
  82. EXTERN_FUNCTION(void vecsri, (PLACE *u, int l, int i));
  83.     /* b=u[l]%2^i; u[l]/=2^i;     0<i<LOGRADIX  */
  84.  
  85. EXTERN_FUNCTION(PLACE *    newvec, (int *maxl));
  86. EXTERN_FUNCTION(void delvec, (PLACE *u, int maxl));
  87.  
  88. EXTERN_FUNCTION(Integer * newInteger, (_VOID_));
  89. EXTERN_FUNCTION(void delInteger, (Integer *u));
  90.  
  91.  
  92. EXTERN_FUNCTION(void karatsuba_mult, (PLACE *prod, PLACE *a, PLACE *b, PLACE *tmp, int n2));
  93.  
  94. #endif
  95.